<html>
<head>
<script>
function log(message) {
  var p = document.createElement("p");
  p.appendChild(document.createTextNode(message));
  document.getElementById("console").appendChild(p);
}

function handleScriptOnError()
{
    log('onerror called (good!)');
}
</script>
</head>
<body>
    <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=13584">bug 13584</a>:
    &lt;script> code wrongly assumes requests can't fail.</p>
    <p>No crash == SUCCESS.</p>
    
    <div id=console></div>
    
    <script onerror="handleScriptOnError()" id=test_script></script>

    <script>
        if (window.testRunner)
            testRunner.dumpAsText();

        <!-- we are an HTTP test so the security origin will fail the file method -->
        document.getElementById('test_script').src = "file:///foobar";
        
        script = document.createElement("script");
        script.setAttribute("src", "file:///foobar");
        script.setAttribute("onerror", "handleScriptOnError()");
        document.body.appendChild(script);
    </script>
</body>
</html>
